﻿function Location(){
this.items={
   '0':{1:'增值税',22:'资源税',44:'A',66:'1'},
   '0,1':{2:'印花税'},
   '0,22':{23:'损耗费'},
   '0,44':{45:'a',46:'b',47:'c'},
   '0,66':{67:'2',68:'3'}};
}
Location.prototype.find	= function(id) {
	if(typeof(this.items[id]) == "undefined")
		return false;
	return this.items[id];
}

Location.prototype.fillOption	= function(el_id , loc_id , selectedText) {
	var el	= el_id;
	
	var json = this.find(loc_id);
	
	if (json) {
		var index	= 0;
		var selected_index	= 0;
		$.each(json , function(k , v) {
			var option	= '<option value="'+k+'">'+v+'</option>';
			el.append(option);
			if (v == selectedText) {
				selected_index	= index;
			}
			index++;
		})
		el.attr('selectedText',selectedText);
	}
}